//
//  HLHomeTableView.m
//  HanlinWeather
//
//  Created by 任翰林 on 2017/2/21.
//  Copyright © 2017年 任翰林. All rights reserved.
//

#import "HLHomeTableView.h"
#import "GaoDeMapViewController.h"


@interface HLHomeTableView ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)GaoDeMapViewController * gaodeMapVC;


@end

@implementation HLHomeTableView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
{
    if ([super initWithFrame:frame style:style]) {
        
        self.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];//多余的cell不显示出来
        self.delegate = self;
        self.dataSource = self;
//        [self setSeparatorStyle:UITableViewCellSeparatorStyleNone];//让空白cell不显示
        
        GaoDeMapViewController * gaodemaoVC = [[GaoDeMapViewController alloc]init];
        self.gaodeMapVC = gaodemaoVC;
}
    
    return self;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
    return 3;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{

    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
//    cell.backgroundColor = KLightGray;
    cell.textLabel.text = [NSString stringWithFormat:@"%ld组，%ld行",indexPath.section,indexPath.row];
    if (indexPath.section == 0 && indexPath.row == 0) {
        cell.textLabel.text = @"地图";
    }else if (indexPath.section == 0 && indexPath.row == 1){
        cell.textLabel.text = @"视频";
    }else if (indexPath.section == 0 && indexPath.row == 2){
        cell.textLabel.text = @"即时通信";
    }else if (indexPath.section == 1 && indexPath.row == 0){
        cell.textLabel.text = @"音乐播放器";
    }else if (indexPath.section == 1 && indexPath.row == 1){
        cell.textLabel.text = @"购物车";
    }else if (indexPath.section == 1 && indexPath.row == 2){
        cell.textLabel.text = @"下载与上传";
    }

    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    self.homeTablePushBlock(indexPath.section,indexPath.row);
  
}




@end
